package khs.java_memory.main.java;

import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        System.out.println("=========> JVM");
        System.out.println("total memory: " + Runtime.getRuntime().totalMemory());
        System.out.println("available processors: " + Runtime.getRuntime().availableProcessors());
        System.out.println("free memory: " + Runtime.getRuntime().freeMemory());
        System.out.println("max memory: " + Runtime.getRuntime().maxMemory());
        
        com.sun.management.OperatingSystemMXBean operatingSystemMXBean = (com.sun.management.OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean();
        
        System.out.println("=========> SYSTEM");
        System.out.println("total memory: " + operatingSystemMXBean.getTotalPhysicalMemorySize());
        System.out.println("free memory: " + operatingSystemMXBean.getFreePhysicalMemorySize());
    }
}
